{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 6: Index Alignment\n",
    "## Recipes\n",
    "* [Examining the Index object](#Examining-the-index)\n",
    "* [Producing Cartesian products](#Producing-Cartesian-products)\n",
    "* [Exploding indexes](#Exploding-Indexes)\n",
    "* [Filling values with unequal indexes](#Filling-values-with-unequal-indexes)\n",
    "* [Appending columns from different DataFrames](#Appending-columns-from-different-DataFrames)\n",
    "* [Highlighting the maximum value from each column](#Highlighting-maximum-value-from-each-column)\n",
    "* [Replicating idxmax with method chaining](#Replicating-idxmax-with-method-chaining)\n",
    "* [Finding the most common maximum](#Finding-the-most-common-maximum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Examining the index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['INSTNM', 'CITY', 'STABBR', 'HBCU', 'MENONLY', 'WOMENONLY', 'RELAFFIL',\n",
       "       'SATVRMID', 'SATMTMID', 'DISTANCEONLY', 'UGDS', 'UGDS_WHITE',\n",
       "       'UGDS_BLACK', 'UGDS_HISP', 'UGDS_ASIAN', 'UGDS_AIAN', 'UGDS_NHPI',\n",
       "       'UGDS_2MOR', 'UGDS_NRA', 'UGDS_UNKN', 'PPTUG_EF', 'CURROPER', 'PCTPELL',\n",
       "       'PCTFLOAN', 'UG25ABV', 'MD_EARN_WNE_P10', 'GRAD_DEBT_MDN_SUPP'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college = pd.read_csv('data/college.csv')\n",
    "columns = college.columns\n",
    "columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['INSTNM', 'CITY', 'STABBR', 'HBCU', 'MENONLY', 'WOMENONLY',\n",
       "       'RELAFFIL', 'SATVRMID', 'SATMTMID', 'DISTANCEONLY', 'UGDS',\n",
       "       'UGDS_WHITE', 'UGDS_BLACK', 'UGDS_HISP', 'UGDS_ASIAN', 'UGDS_AIAN',\n",
       "       'UGDS_NHPI', 'UGDS_2MOR', 'UGDS_NRA', 'UGDS_UNKN', 'PPTUG_EF',\n",
       "       'CURROPER', 'PCTPELL', 'PCTFLOAN', 'UG25ABV', 'MD_EARN_WNE_P10',\n",
       "       'GRAD_DEBT_MDN_SUPP'], dtype=object)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "columns.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'WOMENONLY'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "columns[5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['CITY', 'SATMTMID', 'UGDS'], dtype='object')"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "columns[[1,8,10]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['PPTUG_EF', 'CURROPER', 'PCTPELL'], dtype='object')"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "columns[-7:-4]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "('CITY', 'WOMENONLY', 0)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "columns.min(), columns.max(), columns.isnull().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['INSTNM_A', 'CITY_A', 'STABBR_A', 'HBCU_A', 'MENONLY_A', 'WOMENONLY_A',\n",
       "       'RELAFFIL_A', 'SATVRMID_A', 'SATMTMID_A', 'DISTANCEONLY_A', 'UGDS_A',\n",
       "       'UGDS_WHITE_A', 'UGDS_BLACK_A', 'UGDS_HISP_A', 'UGDS_ASIAN_A',\n",
       "       'UGDS_AIAN_A', 'UGDS_NHPI_A', 'UGDS_2MOR_A', 'UGDS_NRA_A',\n",
       "       'UGDS_UNKN_A', 'PPTUG_EF_A', 'CURROPER_A', 'PCTPELL_A', 'PCTFLOAN_A',\n",
       "       'UG25ABV_A', 'MD_EARN_WNE_P10_A', 'GRAD_DEBT_MDN_SUPP_A'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "columns + '_A'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ True, False,  True,  True,  True,  True,  True,  True,  True,\n",
       "       False,  True,  True,  True,  True,  True,  True,  True,  True,\n",
       "        True,  True,  True, False,  True,  True,  True,  True,  True], dtype=bool)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "columns > 'G'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "Index does not support mutable operations",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-10-1e9e8e3125de>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mcolumns\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'city'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;32m/Users/Ted/anaconda/lib/python3.6/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36m__setitem__\u001b[0;34m(self, key, value)\u001b[0m\n\u001b[1;32m   1668\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1669\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0m__setitem__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1670\u001b[0;31m         \u001b[0;32mraise\u001b[0m \u001b[0mTypeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Index does not support mutable operations\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1671\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1672\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0m__getitem__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mTypeError\u001b[0m: Index does not support mutable operations"
     ]
    }
   ],
   "source": [
    "columns[1] = 'city'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['INSTNM', 'CITY', 'STABBR', 'HBCU'], dtype='object')"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c1 = columns[:4]\n",
    "c1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['STABBR', 'HBCU', 'MENONLY'], dtype='object')"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c2 = columns[2:5]\n",
    "c2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['CITY', 'HBCU', 'INSTNM', 'MENONLY', 'STABBR'], dtype='object')"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c1.union(c2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['CITY', 'HBCU', 'INSTNM', 'MENONLY', 'STABBR'], dtype='object')"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c1 | c2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['CITY', 'INSTNM', 'MENONLY'], dtype='object')"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c1.symmetric_difference(c2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['CITY', 'INSTNM', 'MENONLY'], dtype='object')"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c1 ^ c2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Producing Cartesian products"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    0\n",
       "a    1\n",
       "a    2\n",
       "b    3\n",
       "dtype: int64"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1 = pd.Series(index=list('aaab'), data=np.arange(4))\n",
    "s1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "c    0\n",
       "a    1\n",
       "b    2\n",
       "a    3\n",
       "b    4\n",
       "b    5\n",
       "dtype: int64"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s2 = pd.Series(index=list('cababb'), data=np.arange(6))\n",
    "s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    1.0\n",
       "a    3.0\n",
       "a    2.0\n",
       "a    4.0\n",
       "a    3.0\n",
       "a    5.0\n",
       "b    5.0\n",
       "b    7.0\n",
       "b    8.0\n",
       "c    NaN\n",
       "dtype: float64"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1 + s2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## There's more"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    0\n",
       "a    2\n",
       "a    4\n",
       "b    6\n",
       "b    8\n",
       "dtype: int64"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1 = pd.Series(index=list('aaabb'), data=np.arange(5))\n",
    "s2 = pd.Series(index=list('aaabb'), data=np.arange(5))\n",
    "s1 + s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    2\n",
       "a    3\n",
       "a    4\n",
       "a    3\n",
       "a    4\n",
       "a    5\n",
       "a    4\n",
       "a    5\n",
       "a    6\n",
       "b    3\n",
       "b    4\n",
       "b    4\n",
       "b    5\n",
       "dtype: int64"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1 = pd.Series(index=list('aaabb'), data=np.arange(5))\n",
    "s2 = pd.Series(index=list('bbaaa'), data=np.arange(5))\n",
    "s1 + s2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Exploding Indexes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>UNIQUE_ID</th>\n",
       "      <th>POSITION_TITLE</th>\n",
       "      <th>DEPARTMENT</th>\n",
       "      <th>BASE_SALARY</th>\n",
       "      <th>EMPLOYMENT_TYPE</th>\n",
       "      <th>GENDER</th>\n",
       "      <th>EMPLOYMENT_STATUS</th>\n",
       "      <th>HIRE_DATE</th>\n",
       "      <th>JOB_DATE</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>RACE</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Hispanic/Latino</th>\n",
       "      <td>0</td>\n",
       "      <td>ASSISTANT DIRECTOR (EX LVL)</td>\n",
       "      <td>Municipal Courts Department</td>\n",
       "      <td>121862.0</td>\n",
       "      <td>Full Time</td>\n",
       "      <td>Female</td>\n",
       "      <td>Active</td>\n",
       "      <td>2006-06-12</td>\n",
       "      <td>2012-10-13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Hispanic/Latino</th>\n",
       "      <td>1</td>\n",
       "      <td>LIBRARY ASSISTANT</td>\n",
       "      <td>Library</td>\n",
       "      <td>26125.0</td>\n",
       "      <td>Full Time</td>\n",
       "      <td>Female</td>\n",
       "      <td>Active</td>\n",
       "      <td>2000-07-19</td>\n",
       "      <td>2010-09-18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>White</th>\n",
       "      <td>2</td>\n",
       "      <td>POLICE OFFICER</td>\n",
       "      <td>Houston Police Department-HPD</td>\n",
       "      <td>45279.0</td>\n",
       "      <td>Full Time</td>\n",
       "      <td>Male</td>\n",
       "      <td>Active</td>\n",
       "      <td>2015-02-03</td>\n",
       "      <td>2015-02-03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>White</th>\n",
       "      <td>3</td>\n",
       "      <td>ENGINEER/OPERATOR</td>\n",
       "      <td>Houston Fire Department (HFD)</td>\n",
       "      <td>63166.0</td>\n",
       "      <td>Full Time</td>\n",
       "      <td>Male</td>\n",
       "      <td>Active</td>\n",
       "      <td>1982-02-08</td>\n",
       "      <td>1991-05-25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>White</th>\n",
       "      <td>4</td>\n",
       "      <td>ELECTRICIAN</td>\n",
       "      <td>General Services Department</td>\n",
       "      <td>56347.0</td>\n",
       "      <td>Full Time</td>\n",
       "      <td>Male</td>\n",
       "      <td>Active</td>\n",
       "      <td>1989-06-19</td>\n",
       "      <td>1994-10-22</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 UNIQUE_ID               POSITION_TITLE  \\\n",
       "RACE                                                      \n",
       "Hispanic/Latino          0  ASSISTANT DIRECTOR (EX LVL)   \n",
       "Hispanic/Latino          1            LIBRARY ASSISTANT   \n",
       "White                    2               POLICE OFFICER   \n",
       "White                    3            ENGINEER/OPERATOR   \n",
       "White                    4                  ELECTRICIAN   \n",
       "\n",
       "                                    DEPARTMENT  BASE_SALARY EMPLOYMENT_TYPE  \\\n",
       "RACE                                                                          \n",
       "Hispanic/Latino    Municipal Courts Department     121862.0       Full Time   \n",
       "Hispanic/Latino                        Library      26125.0       Full Time   \n",
       "White            Houston Police Department-HPD      45279.0       Full Time   \n",
       "White            Houston Fire Department (HFD)      63166.0       Full Time   \n",
       "White              General Services Department      56347.0       Full Time   \n",
       "\n",
       "                 GENDER EMPLOYMENT_STATUS   HIRE_DATE    JOB_DATE  \n",
       "RACE                                                               \n",
       "Hispanic/Latino  Female            Active  2006-06-12  2012-10-13  \n",
       "Hispanic/Latino  Female            Active  2000-07-19  2010-09-18  \n",
       "White              Male            Active  2015-02-03  2015-02-03  \n",
       "White              Male            Active  1982-02-08  1991-05-25  \n",
       "White              Male            Active  1989-06-19  1994-10-22  "
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employee = pd.read_csv('data/employee.csv', index_col='RACE')\n",
    "employee.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "salary1 = employee['BASE_SALARY']\n",
    "salary2 = employee['BASE_SALARY']\n",
    "salary1 is salary2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "salary1 = employee['BASE_SALARY'].copy()\n",
    "salary2 = employee['BASE_SALARY'].copy()\n",
    "salary1 is salary2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RACE\n",
       "American Indian or Alaskan Native    78355.0\n",
       "American Indian or Alaskan Native    26125.0\n",
       "American Indian or Alaskan Native    98536.0\n",
       "American Indian or Alaskan Native        NaN\n",
       "American Indian or Alaskan Native    55461.0\n",
       "Name: BASE_SALARY, dtype: float64"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "salary1 = salary1.sort_index()\n",
    "salary1.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RACE\n",
       "Hispanic/Latino    121862.0\n",
       "Hispanic/Latino     26125.0\n",
       "White               45279.0\n",
       "White               63166.0\n",
       "White               56347.0\n",
       "Name: BASE_SALARY, dtype: float64"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "salary2.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "salary_add = salary1 + salary2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RACE\n",
       "American Indian or Alaskan Native    138702.0\n",
       "American Indian or Alaskan Native    156710.0\n",
       "American Indian or Alaskan Native    176891.0\n",
       "American Indian or Alaskan Native    159594.0\n",
       "American Indian or Alaskan Native    127734.0\n",
       "Name: BASE_SALARY, dtype: float64"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "salary_add.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2000, 2000, 1175424, 2000)"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "salary_add1 = salary1 + salary1\n",
    "len(salary1), len(salary2), len(salary_add), len(salary_add1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## There's more..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Black or African American            700\n",
       "White                                665\n",
       "Hispanic/Latino                      480\n",
       "Asian/Pacific Islander               107\n",
       "NaN                                   35\n",
       "American Indian or Alaskan Native     11\n",
       "Others                                 2\n",
       "Name: RACE, dtype: int64"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "index_vc = salary1.index.value_counts(dropna=False)\n",
    "index_vc"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1175424"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "index_vc.pow(2).sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Filling values with unequal indexes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>yearID</th>\n",
       "      <th>stint</th>\n",
       "      <th>teamID</th>\n",
       "      <th>lgID</th>\n",
       "      <th>G</th>\n",
       "      <th>AB</th>\n",
       "      <th>R</th>\n",
       "      <th>H</th>\n",
       "      <th>2B</th>\n",
       "      <th>3B</th>\n",
       "      <th>...</th>\n",
       "      <th>RBI</th>\n",
       "      <th>SB</th>\n",
       "      <th>CS</th>\n",
       "      <th>BB</th>\n",
       "      <th>SO</th>\n",
       "      <th>IBB</th>\n",
       "      <th>HBP</th>\n",
       "      <th>SH</th>\n",
       "      <th>SF</th>\n",
       "      <th>GIDP</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>playerID</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>altuvjo01</th>\n",
       "      <td>2014</td>\n",
       "      <td>1</td>\n",
       "      <td>HOU</td>\n",
       "      <td>AL</td>\n",
       "      <td>158</td>\n",
       "      <td>660</td>\n",
       "      <td>85</td>\n",
       "      <td>225</td>\n",
       "      <td>47</td>\n",
       "      <td>3</td>\n",
       "      <td>...</td>\n",
       "      <td>59.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>36</td>\n",
       "      <td>53.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>20.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>cartech02</th>\n",
       "      <td>2014</td>\n",
       "      <td>1</td>\n",
       "      <td>HOU</td>\n",
       "      <td>AL</td>\n",
       "      <td>145</td>\n",
       "      <td>507</td>\n",
       "      <td>68</td>\n",
       "      <td>115</td>\n",
       "      <td>21</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>88.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>56</td>\n",
       "      <td>182.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>12.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>castrja01</th>\n",
       "      <td>2014</td>\n",
       "      <td>1</td>\n",
       "      <td>HOU</td>\n",
       "      <td>AL</td>\n",
       "      <td>126</td>\n",
       "      <td>465</td>\n",
       "      <td>43</td>\n",
       "      <td>103</td>\n",
       "      <td>21</td>\n",
       "      <td>2</td>\n",
       "      <td>...</td>\n",
       "      <td>56.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>34</td>\n",
       "      <td>151.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>11.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>corpoca01</th>\n",
       "      <td>2014</td>\n",
       "      <td>1</td>\n",
       "      <td>HOU</td>\n",
       "      <td>AL</td>\n",
       "      <td>55</td>\n",
       "      <td>170</td>\n",
       "      <td>22</td>\n",
       "      <td>40</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>19.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14</td>\n",
       "      <td>37.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dominma01</th>\n",
       "      <td>2014</td>\n",
       "      <td>1</td>\n",
       "      <td>HOU</td>\n",
       "      <td>AL</td>\n",
       "      <td>157</td>\n",
       "      <td>564</td>\n",
       "      <td>51</td>\n",
       "      <td>121</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>57.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>29</td>\n",
       "      <td>125.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>23.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           yearID  stint teamID lgID    G   AB   R    H  2B  3B  ...    RBI  \\\n",
       "playerID                                                         ...          \n",
       "altuvjo01    2014      1    HOU   AL  158  660  85  225  47   3  ...   59.0   \n",
       "cartech02    2014      1    HOU   AL  145  507  68  115  21   1  ...   88.0   \n",
       "castrja01    2014      1    HOU   AL  126  465  43  103  21   2  ...   56.0   \n",
       "corpoca01    2014      1    HOU   AL   55  170  22   40   6   0  ...   19.0   \n",
       "dominma01    2014      1    HOU   AL  157  564  51  121  17   0  ...   57.0   \n",
       "\n",
       "             SB   CS  BB     SO  IBB  HBP   SH   SF  GIDP  \n",
       "playerID                                                   \n",
       "altuvjo01  56.0  9.0  36   53.0  7.0  5.0  1.0  5.0  20.0  \n",
       "cartech02   5.0  2.0  56  182.0  6.0  5.0  0.0  4.0  12.0  \n",
       "castrja01   1.0  0.0  34  151.0  1.0  9.0  1.0  3.0  11.0  \n",
       "corpoca01   0.0  0.0  14   37.0  0.0  3.0  1.0  2.0   3.0  \n",
       "dominma01   0.0  1.0  29  125.0  2.0  5.0  2.0  7.0  23.0  \n",
       "\n",
       "[5 rows x 21 columns]"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "baseball_14 = pd.read_csv('data/baseball14.csv', index_col='playerID')\n",
    "baseball_15 = pd.read_csv('data/baseball15.csv', index_col='playerID')\n",
    "baseball_16 = pd.read_csv('data/baseball16.csv', index_col='playerID')\n",
    "baseball_14.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['corpoca01', 'dominma01', 'fowlede01', 'grossro01', 'guzmaje01',\n",
       "       'hoeslj01', 'krausma01', 'preslal01', 'singljo02'],\n",
       "      dtype='object', name='playerID')"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "baseball_14.index.difference(baseball_15.index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['corpoca01', 'dominma01', 'fowlede01', 'grossro01', 'guzmaje01',\n",
       "       'hoeslj01', 'krausma01', 'preslal01', 'singljo02'],\n",
       "      dtype='object', name='playerID')"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "baseball_14.index.difference(baseball_15.index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "playerID\n",
       "altuvjo01    225\n",
       "cartech02    115\n",
       "castrja01    103\n",
       "corpoca01     40\n",
       "dominma01    121\n",
       "Name: H, dtype: int64"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hits_14 = baseball_14['H']\n",
    "hits_15 = baseball_15['H']\n",
    "hits_16 = baseball_16['H']\n",
    "hits_14.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "playerID\n",
       "altuvjo01    425.0\n",
       "cartech02    193.0\n",
       "castrja01    174.0\n",
       "congeha01      NaN\n",
       "corpoca01      NaN\n",
       "Name: H, dtype: float64"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(hits_14 + hits_15).head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "playerID\n",
       "altuvjo01    425.0\n",
       "cartech02    193.0\n",
       "castrja01    174.0\n",
       "congeha01     46.0\n",
       "corpoca01     40.0\n",
       "Name: H, dtype: float64"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hits_14.add(hits_15, fill_value=0).head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "playerID\n",
       "altuvjo01    641.0\n",
       "bregmal01     53.0\n",
       "cartech02    193.0\n",
       "castrja01    243.0\n",
       "congeha01     46.0\n",
       "Name: H, dtype: float64"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hits_total = hits_14.add(hits_15, fill_value=0).add(hits_16, fill_value=0)\n",
    "hits_total.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hits_total.hasnans"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## How it works..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    NaN\n",
       "b    3.0\n",
       "c    NaN\n",
       "d    1.0\n",
       "dtype: float64"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s = pd.Series(index=['a', 'b', 'c', 'd'], data=[np.nan, 3, np.nan, 1])\n",
    "s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a     NaN\n",
       "b     6.0\n",
       "c    10.0\n",
       "dtype: float64"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1 = pd.Series(index=['a', 'b', 'c'], data=[np.nan, 6, 10])\n",
    "s1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a     NaN\n",
       "b     9.0\n",
       "c    15.0\n",
       "d     6.0\n",
       "dtype: float64"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.add(s1, fill_value=5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a     NaN\n",
       "b     9.0\n",
       "c    15.0\n",
       "d     6.0\n",
       "dtype: float64"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1.add(s, fill_value=5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## There's more"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>G</th>\n",
       "      <th>AB</th>\n",
       "      <th>R</th>\n",
       "      <th>H</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>playerID</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>altuvjo01</th>\n",
       "      <td>158</td>\n",
       "      <td>660</td>\n",
       "      <td>85</td>\n",
       "      <td>225</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>cartech02</th>\n",
       "      <td>145</td>\n",
       "      <td>507</td>\n",
       "      <td>68</td>\n",
       "      <td>115</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>castrja01</th>\n",
       "      <td>126</td>\n",
       "      <td>465</td>\n",
       "      <td>43</td>\n",
       "      <td>103</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>corpoca01</th>\n",
       "      <td>55</td>\n",
       "      <td>170</td>\n",
       "      <td>22</td>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dominma01</th>\n",
       "      <td>157</td>\n",
       "      <td>564</td>\n",
       "      <td>51</td>\n",
       "      <td>121</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             G   AB   R    H\n",
       "playerID                    \n",
       "altuvjo01  158  660  85  225\n",
       "cartech02  145  507  68  115\n",
       "castrja01  126  465  43  103\n",
       "corpoca01   55  170  22   40\n",
       "dominma01  157  564  51  121"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_14 = baseball_14[['G','AB', 'R', 'H']]\n",
    "df_14.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AB</th>\n",
       "      <th>R</th>\n",
       "      <th>H</th>\n",
       "      <th>HR</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>playerID</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>altuvjo01</th>\n",
       "      <td>638</td>\n",
       "      <td>86</td>\n",
       "      <td>200</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>cartech02</th>\n",
       "      <td>391</td>\n",
       "      <td>50</td>\n",
       "      <td>78</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>castrja01</th>\n",
       "      <td>337</td>\n",
       "      <td>38</td>\n",
       "      <td>71</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>congeha01</th>\n",
       "      <td>201</td>\n",
       "      <td>25</td>\n",
       "      <td>46</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>correca01</th>\n",
       "      <td>387</td>\n",
       "      <td>52</td>\n",
       "      <td>108</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            AB   R    H  HR\n",
       "playerID                   \n",
       "altuvjo01  638  86  200  15\n",
       "cartech02  391  50   78  24\n",
       "castrja01  337  38   71  11\n",
       "congeha01  201  25   46  11\n",
       "correca01  387  52  108  22"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_15 = baseball_15[['AB', 'R', 'H', 'HR']]\n",
    "df_15.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow0_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow0_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow1_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow1_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow2_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow2_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow3_col0 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow3_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow3_col2 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow3_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow3_col4 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow4_col0 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow4_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow4_col2 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow4_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow4_col4 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow5_col0 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow5_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow5_col2 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow5_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow5_col4 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow6_col0 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow6_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow6_col2 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow6_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow6_col4 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow7_col0 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow7_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow7_col2 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow7_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow7_col4 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow8_col0 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow8_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow8_col2 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow8_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow8_col4 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow9_col0 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow9_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow9_col2 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow9_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow9_col4 {\n",
       "            background-color:  yellow;\n",
       "        }</style>  \n",
       "<table id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68c\" > \n",
       "<thead>    <tr> \n",
       "        <th class=\"blank level0\" ></th> \n",
       "        <th class=\"col_heading level0 col0\" >AB</th> \n",
       "        <th class=\"col_heading level0 col1\" >G</th> \n",
       "        <th class=\"col_heading level0 col2\" >H</th> \n",
       "        <th class=\"col_heading level0 col3\" >HR</th> \n",
       "        <th class=\"col_heading level0 col4\" >R</th> \n",
       "    </tr>    <tr> \n",
       "        <th class=\"index_name level0\" >playerID</th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "    </tr></thead> \n",
       "<tbody>    <tr> \n",
       "        <th id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68clevel0_row0\" class=\"row_heading level0 row0\" >altuvjo01</th> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow0_col0\" class=\"data row0 col0\" >1298</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow0_col1\" class=\"data row0 col1\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow0_col2\" class=\"data row0 col2\" >425</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow0_col3\" class=\"data row0 col3\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow0_col4\" class=\"data row0 col4\" >171</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68clevel0_row1\" class=\"row_heading level0 row1\" >cartech02</th> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow1_col0\" class=\"data row1 col0\" >898</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow1_col1\" class=\"data row1 col1\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow1_col2\" class=\"data row1 col2\" >193</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow1_col3\" class=\"data row1 col3\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow1_col4\" class=\"data row1 col4\" >118</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68clevel0_row2\" class=\"row_heading level0 row2\" >castrja01</th> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow2_col0\" class=\"data row2 col0\" >802</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow2_col1\" class=\"data row2 col1\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow2_col2\" class=\"data row2 col2\" >174</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow2_col3\" class=\"data row2 col3\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow2_col4\" class=\"data row2 col4\" >81</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68clevel0_row3\" class=\"row_heading level0 row3\" >congeha01</th> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow3_col0\" class=\"data row3 col0\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow3_col1\" class=\"data row3 col1\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow3_col2\" class=\"data row3 col2\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow3_col3\" class=\"data row3 col3\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow3_col4\" class=\"data row3 col4\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68clevel0_row4\" class=\"row_heading level0 row4\" >corpoca01</th> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow4_col0\" class=\"data row4 col0\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow4_col1\" class=\"data row4 col1\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow4_col2\" class=\"data row4 col2\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow4_col3\" class=\"data row4 col3\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow4_col4\" class=\"data row4 col4\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68clevel0_row5\" class=\"row_heading level0 row5\" >correca01</th> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow5_col0\" class=\"data row5 col0\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow5_col1\" class=\"data row5 col1\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow5_col2\" class=\"data row5 col2\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow5_col3\" class=\"data row5 col3\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow5_col4\" class=\"data row5 col4\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68clevel0_row6\" class=\"row_heading level0 row6\" >dominma01</th> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow6_col0\" class=\"data row6 col0\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow6_col1\" class=\"data row6 col1\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow6_col2\" class=\"data row6 col2\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow6_col3\" class=\"data row6 col3\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow6_col4\" class=\"data row6 col4\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68clevel0_row7\" class=\"row_heading level0 row7\" >fowlede01</th> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow7_col0\" class=\"data row7 col0\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow7_col1\" class=\"data row7 col1\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow7_col2\" class=\"data row7 col2\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow7_col3\" class=\"data row7 col3\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow7_col4\" class=\"data row7 col4\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68clevel0_row8\" class=\"row_heading level0 row8\" >gattiev01</th> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow8_col0\" class=\"data row8 col0\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow8_col1\" class=\"data row8 col1\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow8_col2\" class=\"data row8 col2\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow8_col3\" class=\"data row8 col3\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow8_col4\" class=\"data row8 col4\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68clevel0_row9\" class=\"row_heading level0 row9\" >gomezca01</th> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow9_col0\" class=\"data row9 col0\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow9_col1\" class=\"data row9 col1\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow9_col2\" class=\"data row9 col2\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow9_col3\" class=\"data row9 col3\" >nan</td> \n",
       "        <td id=\"T_e00e2974_b3cc_11e7_bff6_b8e85647e68crow9_col4\" class=\"data row9 col4\" >nan</td> \n",
       "    </tr></tbody> \n",
       "</table> "
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x1108b03c8>"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(df_14 + df_15).head(10).style.highlight_null('yellow')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_e013947a_b3cc_11e7_9934_b8e85647e68crow3_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e013947a_b3cc_11e7_9934_b8e85647e68crow4_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e013947a_b3cc_11e7_9934_b8e85647e68crow5_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e013947a_b3cc_11e7_9934_b8e85647e68crow6_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e013947a_b3cc_11e7_9934_b8e85647e68crow7_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e013947a_b3cc_11e7_9934_b8e85647e68crow8_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e013947a_b3cc_11e7_9934_b8e85647e68crow9_col1 {\n",
       "            background-color:  yellow;\n",
       "        }</style>  \n",
       "<table id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68c\" > \n",
       "<thead>    <tr> \n",
       "        <th class=\"blank level0\" ></th> \n",
       "        <th class=\"col_heading level0 col0\" >AB</th> \n",
       "        <th class=\"col_heading level0 col1\" >G</th> \n",
       "        <th class=\"col_heading level0 col2\" >H</th> \n",
       "        <th class=\"col_heading level0 col3\" >HR</th> \n",
       "        <th class=\"col_heading level0 col4\" >R</th> \n",
       "    </tr>    <tr> \n",
       "        <th class=\"index_name level0\" >playerID</th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "    </tr></thead> \n",
       "<tbody>    <tr> \n",
       "        <th id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68clevel0_row0\" class=\"row_heading level0 row0\" >altuvjo01</th> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow0_col0\" class=\"data row0 col0\" >1298</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow0_col1\" class=\"data row0 col1\" >158</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow0_col2\" class=\"data row0 col2\" >425</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow0_col3\" class=\"data row0 col3\" >15</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow0_col4\" class=\"data row0 col4\" >171</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68clevel0_row1\" class=\"row_heading level0 row1\" >cartech02</th> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow1_col0\" class=\"data row1 col0\" >898</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow1_col1\" class=\"data row1 col1\" >145</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow1_col2\" class=\"data row1 col2\" >193</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow1_col3\" class=\"data row1 col3\" >24</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow1_col4\" class=\"data row1 col4\" >118</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68clevel0_row2\" class=\"row_heading level0 row2\" >castrja01</th> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow2_col0\" class=\"data row2 col0\" >802</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow2_col1\" class=\"data row2 col1\" >126</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow2_col2\" class=\"data row2 col2\" >174</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow2_col3\" class=\"data row2 col3\" >11</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow2_col4\" class=\"data row2 col4\" >81</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68clevel0_row3\" class=\"row_heading level0 row3\" >congeha01</th> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow3_col0\" class=\"data row3 col0\" >201</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow3_col1\" class=\"data row3 col1\" >nan</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow3_col2\" class=\"data row3 col2\" >46</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow3_col3\" class=\"data row3 col3\" >11</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow3_col4\" class=\"data row3 col4\" >25</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68clevel0_row4\" class=\"row_heading level0 row4\" >corpoca01</th> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow4_col0\" class=\"data row4 col0\" >170</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow4_col1\" class=\"data row4 col1\" >55</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow4_col2\" class=\"data row4 col2\" >40</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow4_col3\" class=\"data row4 col3\" >nan</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow4_col4\" class=\"data row4 col4\" >22</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68clevel0_row5\" class=\"row_heading level0 row5\" >correca01</th> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow5_col0\" class=\"data row5 col0\" >387</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow5_col1\" class=\"data row5 col1\" >nan</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow5_col2\" class=\"data row5 col2\" >108</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow5_col3\" class=\"data row5 col3\" >22</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow5_col4\" class=\"data row5 col4\" >52</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68clevel0_row6\" class=\"row_heading level0 row6\" >dominma01</th> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow6_col0\" class=\"data row6 col0\" >564</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow6_col1\" class=\"data row6 col1\" >157</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow6_col2\" class=\"data row6 col2\" >121</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow6_col3\" class=\"data row6 col3\" >nan</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow6_col4\" class=\"data row6 col4\" >51</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68clevel0_row7\" class=\"row_heading level0 row7\" >fowlede01</th> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow7_col0\" class=\"data row7 col0\" >434</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow7_col1\" class=\"data row7 col1\" >116</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow7_col2\" class=\"data row7 col2\" >120</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow7_col3\" class=\"data row7 col3\" >nan</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow7_col4\" class=\"data row7 col4\" >61</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68clevel0_row8\" class=\"row_heading level0 row8\" >gattiev01</th> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow8_col0\" class=\"data row8 col0\" >566</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow8_col1\" class=\"data row8 col1\" >nan</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow8_col2\" class=\"data row8 col2\" >139</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow8_col3\" class=\"data row8 col3\" >27</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow8_col4\" class=\"data row8 col4\" >66</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68clevel0_row9\" class=\"row_heading level0 row9\" >gomezca01</th> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow9_col0\" class=\"data row9 col0\" >149</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow9_col1\" class=\"data row9 col1\" >nan</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow9_col2\" class=\"data row9 col2\" >36</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow9_col3\" class=\"data row9 col3\" >4</td> \n",
       "        <td id=\"T_e013947a_b3cc_11e7_9934_b8e85647e68crow9_col4\" class=\"data row9 col4\" >19</td> \n",
       "    </tr></tbody> \n",
       "</table> "
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x1184bf828>"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_14.add(df_15, fill_value=0).head(10).style.highlight_null('yellow')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Appending columns from different DataFrames"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "employee = pd.read_csv('data/employee.csv')\n",
    "dept_sal = employee[['DEPARTMENT', 'BASE_SALARY']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "dept_sal = dept_sal.sort_values(['DEPARTMENT', 'BASE_SALARY'],\n",
    "                                ascending=[True, False])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DEPARTMENT</th>\n",
       "      <th>BASE_SALARY</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1494</th>\n",
       "      <td>Admn. &amp; Regulatory Affairs</td>\n",
       "      <td>140416.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149</th>\n",
       "      <td>City Controller's Office</td>\n",
       "      <td>64251.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>236</th>\n",
       "      <td>City Council</td>\n",
       "      <td>100000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>647</th>\n",
       "      <td>Convention and Entertainment</td>\n",
       "      <td>38397.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1500</th>\n",
       "      <td>Dept of Neighborhoods (DON)</td>\n",
       "      <td>89221.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                        DEPARTMENT  BASE_SALARY\n",
       "1494    Admn. & Regulatory Affairs     140416.0\n",
       "149       City Controller's Office      64251.0\n",
       "236                   City Council     100000.0\n",
       "647   Convention and Entertainment      38397.0\n",
       "1500   Dept of Neighborhoods (DON)      89221.0"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "max_dept_sal = dept_sal.drop_duplicates(subset='DEPARTMENT')\n",
    "max_dept_sal.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "max_dept_sal = max_dept_sal.set_index('DEPARTMENT')\n",
    "employee = employee.set_index('DEPARTMENT')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "employee['MAX_DEPT_SALARY'] = max_dept_sal['BASE_SALARY']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "pd.options.display.max_columns = 6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>UNIQUE_ID</th>\n",
       "      <th>POSITION_TITLE</th>\n",
       "      <th>BASE_SALARY</th>\n",
       "      <th>...</th>\n",
       "      <th>HIRE_DATE</th>\n",
       "      <th>JOB_DATE</th>\n",
       "      <th>MAX_DEPT_SALARY</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DEPARTMENT</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Municipal Courts Department</th>\n",
       "      <td>0</td>\n",
       "      <td>ASSISTANT DIRECTOR (EX LVL)</td>\n",
       "      <td>121862.0</td>\n",
       "      <td>...</td>\n",
       "      <td>2006-06-12</td>\n",
       "      <td>2012-10-13</td>\n",
       "      <td>121862.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Library</th>\n",
       "      <td>1</td>\n",
       "      <td>LIBRARY ASSISTANT</td>\n",
       "      <td>26125.0</td>\n",
       "      <td>...</td>\n",
       "      <td>2000-07-19</td>\n",
       "      <td>2010-09-18</td>\n",
       "      <td>107763.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Houston Police Department-HPD</th>\n",
       "      <td>2</td>\n",
       "      <td>POLICE OFFICER</td>\n",
       "      <td>45279.0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-02-03</td>\n",
       "      <td>2015-02-03</td>\n",
       "      <td>199596.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Houston Fire Department (HFD)</th>\n",
       "      <td>3</td>\n",
       "      <td>ENGINEER/OPERATOR</td>\n",
       "      <td>63166.0</td>\n",
       "      <td>...</td>\n",
       "      <td>1982-02-08</td>\n",
       "      <td>1991-05-25</td>\n",
       "      <td>210588.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>General Services Department</th>\n",
       "      <td>4</td>\n",
       "      <td>ELECTRICIAN</td>\n",
       "      <td>56347.0</td>\n",
       "      <td>...</td>\n",
       "      <td>1989-06-19</td>\n",
       "      <td>1994-10-22</td>\n",
       "      <td>89194.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                               UNIQUE_ID               POSITION_TITLE  \\\n",
       "DEPARTMENT                                                              \n",
       "Municipal Courts Department            0  ASSISTANT DIRECTOR (EX LVL)   \n",
       "Library                                1            LIBRARY ASSISTANT   \n",
       "Houston Police Department-HPD          2               POLICE OFFICER   \n",
       "Houston Fire Department (HFD)          3            ENGINEER/OPERATOR   \n",
       "General Services Department            4                  ELECTRICIAN   \n",
       "\n",
       "                               BASE_SALARY       ...         HIRE_DATE  \\\n",
       "DEPARTMENT                                       ...                     \n",
       "Municipal Courts Department       121862.0       ...        2006-06-12   \n",
       "Library                            26125.0       ...        2000-07-19   \n",
       "Houston Police Department-HPD      45279.0       ...        2015-02-03   \n",
       "Houston Fire Department (HFD)      63166.0       ...        1982-02-08   \n",
       "General Services Department        56347.0       ...        1989-06-19   \n",
       "\n",
       "                                 JOB_DATE MAX_DEPT_SALARY  \n",
       "DEPARTMENT                                                 \n",
       "Municipal Courts Department    2012-10-13        121862.0  \n",
       "Library                        2010-09-18        107763.0  \n",
       "Houston Police Department-HPD  2015-02-03        199596.0  \n",
       "Houston Fire Department (HFD)  1991-05-25        210588.0  \n",
       "General Services Department    1994-10-22         89194.0  \n",
       "\n",
       "[5 rows x 10 columns]"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employee.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>UNIQUE_ID</th>\n",
       "      <th>POSITION_TITLE</th>\n",
       "      <th>BASE_SALARY</th>\n",
       "      <th>...</th>\n",
       "      <th>HIRE_DATE</th>\n",
       "      <th>JOB_DATE</th>\n",
       "      <th>MAX_DEPT_SALARY</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DEPARTMENT</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>0 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [UNIQUE_ID, POSITION_TITLE, BASE_SALARY, RACE, EMPLOYMENT_TYPE, GENDER, EMPLOYMENT_STATUS, HIRE_DATE, JOB_DATE, MAX_DEPT_SALARY]\n",
       "Index: []\n",
       "\n",
       "[0 rows x 10 columns]"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employee.query('BASE_SALARY > MAX_DEPT_SALARY')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## How it works..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>BASE_SALARY</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DEPARTMENT</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Public Works &amp; Engineering-PWE</th>\n",
       "      <td>50586.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Houston Police Department-HPD</th>\n",
       "      <td>66614.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Houston Police Department-HPD</th>\n",
       "      <td>66614.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Housing and Community Devp.</th>\n",
       "      <td>78853.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Houston Police Department-HPD</th>\n",
       "      <td>66614.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Parks &amp; Recreation</th>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Public Works &amp; Engineering-PWE</th>\n",
       "      <td>37211.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Public Works &amp; Engineering-PWE</th>\n",
       "      <td>54683.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Human Resources Dept.</th>\n",
       "      <td>58474.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Health &amp; Human Services</th>\n",
       "      <td>47050.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                BASE_SALARY\n",
       "DEPARTMENT                                 \n",
       "Public Works & Engineering-PWE      50586.0\n",
       "Houston Police Department-HPD       66614.0\n",
       "Houston Police Department-HPD       66614.0\n",
       "Housing and Community Devp.         78853.0\n",
       "Houston Police Department-HPD       66614.0\n",
       "Parks & Recreation                      NaN\n",
       "Public Works & Engineering-PWE      37211.0\n",
       "Public Works & Engineering-PWE      54683.0\n",
       "Human Resources Dept.               58474.0\n",
       "Health & Human Services             47050.0"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.random.seed(1234)\n",
    "random_salary = dept_sal.sample(n=10).set_index('DEPARTMENT')\n",
    "random_salary"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "cannot reindex from a duplicate axis",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-57-1cbebe15fa39>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0memployee\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'RANDOM_SALARY'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mrandom_salary\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'BASE_SALARY'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;32m/Users/Ted/anaconda/lib/python3.6/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36m__setitem__\u001b[0;34m(self, key, value)\u001b[0m\n\u001b[1;32m   2329\u001b[0m         \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2330\u001b[0m             \u001b[0;31m# set column\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2331\u001b[0;31m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_set_item\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2332\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2333\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0m_setitem_slice\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/Users/Ted/anaconda/lib/python3.6/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36m_set_item\u001b[0;34m(self, key, value)\u001b[0m\n\u001b[1;32m   2395\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2396\u001b[0m         \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_ensure_valid_index\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2397\u001b[0;31m         \u001b[0mvalue\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_sanitize_column\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2398\u001b[0m         \u001b[0mNDFrame\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_set_item\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2399\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/Users/Ted/anaconda/lib/python3.6/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36m_sanitize_column\u001b[0;34m(self, key, value, broadcast)\u001b[0m\n\u001b[1;32m   2545\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2546\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mSeries\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2547\u001b[0;31m             \u001b[0mvalue\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mreindexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2548\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2549\u001b[0m         \u001b[0;32melif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDataFrame\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/Users/Ted/anaconda/lib/python3.6/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36mreindexer\u001b[0;34m(value)\u001b[0m\n\u001b[1;32m   2537\u001b[0m                     \u001b[0;31m# duplicate axis\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2538\u001b[0m                     \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_unique\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2539\u001b[0;31m                         \u001b[0;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2540\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2541\u001b[0m                     \u001b[0;31m# other\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/Users/Ted/anaconda/lib/python3.6/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36mreindexer\u001b[0;34m(value)\u001b[0m\n\u001b[1;32m   2532\u001b[0m                 \u001b[0;31m# GH 4107\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2533\u001b[0m                 \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2534\u001b[0;31m                     \u001b[0mvalue\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_values\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2535\u001b[0m                 \u001b[0;32mexcept\u001b[0m \u001b[0mException\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2536\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/Users/Ted/anaconda/lib/python3.6/site-packages/pandas/core/series.py\u001b[0m in \u001b[0;36mreindex\u001b[0;34m(self, index, **kwargs)\u001b[0m\n\u001b[1;32m   2424\u001b[0m     \u001b[0;34m@\u001b[0m\u001b[0mAppender\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mgeneric\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_shared_docs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'reindex'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0m_shared_doc_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2425\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0mreindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2426\u001b[0;31m         \u001b[0;32mreturn\u001b[0m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mSeries\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2427\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2428\u001b[0m     \u001b[0;34m@\u001b[0m\u001b[0mAppender\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mgeneric\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_shared_docs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'fillna'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0m_shared_doc_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/Users/Ted/anaconda/lib/python3.6/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36mreindex\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m   2513\u001b[0m         \u001b[0;31m# perform the reindex on the axes\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2514\u001b[0m         return self._reindex_axes(axes, level, limit, tolerance, method,\n\u001b[0;32m-> 2515\u001b[0;31m                                   fill_value, copy).__finalize__(self)\n\u001b[0m\u001b[1;32m   2516\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2517\u001b[0m     def _reindex_axes(self, axes, level, limit, tolerance, method, fill_value,\n",
      "\u001b[0;32m/Users/Ted/anaconda/lib/python3.6/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36m_reindex_axes\u001b[0;34m(self, axes, level, limit, tolerance, method, fill_value, copy)\u001b[0m\n\u001b[1;32m   2531\u001b[0m             obj = obj._reindex_with_indexers({axis: [new_index, indexer]},\n\u001b[1;32m   2532\u001b[0m                                              \u001b[0mfill_value\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfill_value\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2533\u001b[0;31m                                              copy=copy, allow_dups=False)\n\u001b[0m\u001b[1;32m   2534\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2535\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/Users/Ted/anaconda/lib/python3.6/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36m_reindex_with_indexers\u001b[0;34m(self, reindexers, fill_value, copy, allow_dups)\u001b[0m\n\u001b[1;32m   2625\u001b[0m                                                 \u001b[0mfill_value\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfill_value\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2626\u001b[0m                                                 \u001b[0mallow_dups\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mallow_dups\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2627\u001b[0;31m                                                 copy=copy)\n\u001b[0m\u001b[1;32m   2628\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2629\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mcopy\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mnew_data\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_data\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/Users/Ted/anaconda/lib/python3.6/site-packages/pandas/core/internals.py\u001b[0m in \u001b[0;36mreindex_indexer\u001b[0;34m(self, new_axis, indexer, axis, fill_value, allow_dups, copy)\u001b[0m\n\u001b[1;32m   3884\u001b[0m         \u001b[0;31m# some axes don't allow reindexing with dups\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3885\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mallow_dups\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3886\u001b[0;31m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maxes\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0maxis\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_can_reindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   3887\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3888\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0maxis\u001b[0m \u001b[0;34m>=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mndim\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/Users/Ted/anaconda/lib/python3.6/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36m_can_reindex\u001b[0;34m(self, indexer)\u001b[0m\n\u001b[1;32m   2834\u001b[0m         \u001b[0;31m# trying to reindex on an axis with duplicates\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2835\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_unique\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2836\u001b[0;31m             \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"cannot reindex from a duplicate axis\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2837\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2838\u001b[0m     def reindex(self, target, method=None, level=None, limit=None,\n",
      "\u001b[0;31mValueError\u001b[0m: cannot reindex from a duplicate axis"
     ]
    }
   ],
   "source": [
    "employee['RANDOM_SALARY'] = random_salary['BASE_SALARY']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## There's more..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "employee['MAX_SALARY2'] = max_dept_sal['BASE_SALARY'].head(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "140416.0    29\n",
       "100000.0    11\n",
       "64251.0      5\n",
       "Name: MAX_SALARY2, dtype: int64"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employee.MAX_SALARY2.value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.97750000000000004"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employee.MAX_SALARY2.isnull().mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Highlighting maximum value from each column"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "pd.options.display.max_rows = 8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "CITY                   object\n",
       "STABBR                 object\n",
       "HBCU                  float64\n",
       "MENONLY               float64\n",
       "                       ...   \n",
       "PCTFLOAN              float64\n",
       "UG25ABV               float64\n",
       "MD_EARN_WNE_P10        object\n",
       "GRAD_DEBT_MDN_SUPP     object\n",
       "Length: 26, dtype: object"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college = pd.read_csv('data/college.csv', index_col='INSTNM')\n",
    "college.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'30300'"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college.MD_EARN_WNE_P10.iloc[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'33888'"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college.GRAD_DEBT_MDN_SUPP.iloc[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "INSTNM\n",
       "Sharon Regional Health System School of Nursing    PrivacySuppressed\n",
       "Northcoast Medical Training Academy                PrivacySuppressed\n",
       "Success Schools                                    PrivacySuppressed\n",
       "Louisiana Culinary Institute                       PrivacySuppressed\n",
       "Bais Medrash Toras Chesed                          PrivacySuppressed\n",
       "Name: MD_EARN_WNE_P10, dtype: object"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college.MD_EARN_WNE_P10.sort_values(ascending=False).head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "MD_EARN_WNE_P10       float64\n",
       "GRAD_DEBT_MDN_SUPP    float64\n",
       "dtype: object"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cols = ['MD_EARN_WNE_P10', 'GRAD_DEBT_MDN_SUPP']\n",
    "for col in cols:\n",
    "    college[col] = pd.to_numeric(college[col], errors='coerce')\n",
    "\n",
    "college.dtypes.loc[cols]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>HBCU</th>\n",
       "      <th>MENONLY</th>\n",
       "      <th>WOMENONLY</th>\n",
       "      <th>...</th>\n",
       "      <th>UG25ABV</th>\n",
       "      <th>MD_EARN_WNE_P10</th>\n",
       "      <th>GRAD_DEBT_MDN_SUPP</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>INSTNM</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Alabama A &amp; M University</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.1049</td>\n",
       "      <td>30300.0</td>\n",
       "      <td>33888.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>University of Alabama at Birmingham</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.2422</td>\n",
       "      <td>39700.0</td>\n",
       "      <td>21941.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Amridge University</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.8540</td>\n",
       "      <td>40100.0</td>\n",
       "      <td>23370.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>University of Alabama in Huntsville</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>45500.0</td>\n",
       "      <td>24097.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Alabama State University</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.1270</td>\n",
       "      <td>26600.0</td>\n",
       "      <td>33118.5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 24 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     HBCU  MENONLY  WOMENONLY  \\\n",
       "INSTNM                                                          \n",
       "Alabama A & M University              1.0      0.0        0.0   \n",
       "University of Alabama at Birmingham   0.0      0.0        0.0   \n",
       "Amridge University                    0.0      0.0        0.0   \n",
       "University of Alabama in Huntsville   0.0      0.0        0.0   \n",
       "Alabama State University              1.0      0.0        0.0   \n",
       "\n",
       "                                            ...          UG25ABV  \\\n",
       "INSTNM                                      ...                    \n",
       "Alabama A & M University                    ...           0.1049   \n",
       "University of Alabama at Birmingham         ...           0.2422   \n",
       "Amridge University                          ...           0.8540   \n",
       "University of Alabama in Huntsville         ...           0.2640   \n",
       "Alabama State University                    ...           0.1270   \n",
       "\n",
       "                                     MD_EARN_WNE_P10  GRAD_DEBT_MDN_SUPP  \n",
       "INSTNM                                                                    \n",
       "Alabama A & M University                     30300.0             33888.0  \n",
       "University of Alabama at Birmingham          39700.0             21941.5  \n",
       "Amridge University                           40100.0             23370.0  \n",
       "University of Alabama in Huntsville          45500.0             24097.0  \n",
       "Alabama State University                     26600.0             33118.5  \n",
       "\n",
       "[5 rows x 24 columns]"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college_n = college.select_dtypes(include=[np.number])\n",
    "college_n.head() # only numeric columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "HBCU          True\n",
       "MENONLY       True\n",
       "WOMENONLY     True\n",
       "RELAFFIL      True\n",
       "SATVRMID     False\n",
       "dtype: bool"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "criteria = college_n.nunique() == 2\n",
    "criteria.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['HBCU', 'MENONLY', 'WOMENONLY', 'RELAFFIL', 'DISTANCEONLY', 'CURROPER']"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "binary_cols = college_n.columns[criteria].tolist()\n",
    "binary_cols"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>SATVRMID</th>\n",
       "      <th>SATMTMID</th>\n",
       "      <th>UGDS</th>\n",
       "      <th>...</th>\n",
       "      <th>UG25ABV</th>\n",
       "      <th>MD_EARN_WNE_P10</th>\n",
       "      <th>GRAD_DEBT_MDN_SUPP</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>INSTNM</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Alabama A &amp; M University</th>\n",
       "      <td>424.0</td>\n",
       "      <td>420.0</td>\n",
       "      <td>4206.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.1049</td>\n",
       "      <td>30300.0</td>\n",
       "      <td>33888.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>University of Alabama at Birmingham</th>\n",
       "      <td>570.0</td>\n",
       "      <td>565.0</td>\n",
       "      <td>11383.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.2422</td>\n",
       "      <td>39700.0</td>\n",
       "      <td>21941.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Amridge University</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>291.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.8540</td>\n",
       "      <td>40100.0</td>\n",
       "      <td>23370.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>University of Alabama in Huntsville</th>\n",
       "      <td>595.0</td>\n",
       "      <td>590.0</td>\n",
       "      <td>5451.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>45500.0</td>\n",
       "      <td>24097.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Alabama State University</th>\n",
       "      <td>425.0</td>\n",
       "      <td>430.0</td>\n",
       "      <td>4811.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.1270</td>\n",
       "      <td>26600.0</td>\n",
       "      <td>33118.5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 18 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     SATVRMID  SATMTMID     UGDS  \\\n",
       "INSTNM                                                             \n",
       "Alabama A & M University                424.0     420.0   4206.0   \n",
       "University of Alabama at Birmingham     570.0     565.0  11383.0   \n",
       "Amridge University                        NaN       NaN    291.0   \n",
       "University of Alabama in Huntsville     595.0     590.0   5451.0   \n",
       "Alabama State University                425.0     430.0   4811.0   \n",
       "\n",
       "                                            ...          UG25ABV  \\\n",
       "INSTNM                                      ...                    \n",
       "Alabama A & M University                    ...           0.1049   \n",
       "University of Alabama at Birmingham         ...           0.2422   \n",
       "Amridge University                          ...           0.8540   \n",
       "University of Alabama in Huntsville         ...           0.2640   \n",
       "Alabama State University                    ...           0.1270   \n",
       "\n",
       "                                     MD_EARN_WNE_P10  GRAD_DEBT_MDN_SUPP  \n",
       "INSTNM                                                                    \n",
       "Alabama A & M University                     30300.0             33888.0  \n",
       "University of Alabama at Birmingham          39700.0             21941.5  \n",
       "Amridge University                           40100.0             23370.0  \n",
       "University of Alabama in Huntsville          45500.0             24097.0  \n",
       "Alabama State University                     26600.0             33118.5  \n",
       "\n",
       "[5 rows x 18 columns]"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college_n2 = college_n.drop(labels=binary_cols, axis='columns')\n",
    "college_n2.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "SATVRMID                      California Institute of Technology\n",
       "SATMTMID                      California Institute of Technology\n",
       "UGDS                               University of Phoenix-Arizona\n",
       "UGDS_WHITE                Mr Leon's School of Hair Design-Moscow\n",
       "                                         ...                    \n",
       "PCTFLOAN                                  ABC Beauty College Inc\n",
       "UG25ABV                           Dongguk University-Los Angeles\n",
       "MD_EARN_WNE_P10                     Medical College of Wisconsin\n",
       "GRAD_DEBT_MDN_SUPP    Southwest University of Visual Arts-Tucson\n",
       "Length: 18, dtype: object"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "max_cols = college_n2.idxmax()\n",
    "max_cols"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['California Institute of Technology',\n",
       "       'University of Phoenix-Arizona',\n",
       "       \"Mr Leon's School of Hair Design-Moscow\",\n",
       "       'Velvatex College of Beauty Culture',\n",
       "       'Thunderbird School of Global Management'], dtype=object)"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "unique_max_cols = max_cols.unique()\n",
    "unique_max_cols[:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col0 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col2 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col3 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col4 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col5 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col12 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col6 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col7 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col8 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col9 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col10 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col11 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col13 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col14 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col14 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col15 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col16 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col17 {\n",
       "            background-color:  yellow;\n",
       "        }</style>  \n",
       "<table id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68c\" > \n",
       "<thead>    <tr> \n",
       "        <th class=\"blank level0\" ></th> \n",
       "        <th class=\"col_heading level0 col0\" >SATVRMID</th> \n",
       "        <th class=\"col_heading level0 col1\" >SATMTMID</th> \n",
       "        <th class=\"col_heading level0 col2\" >UGDS</th> \n",
       "        <th class=\"col_heading level0 col3\" >UGDS_WHITE</th> \n",
       "        <th class=\"col_heading level0 col4\" >UGDS_BLACK</th> \n",
       "        <th class=\"col_heading level0 col5\" >UGDS_HISP</th> \n",
       "        <th class=\"col_heading level0 col6\" >UGDS_ASIAN</th> \n",
       "        <th class=\"col_heading level0 col7\" >UGDS_AIAN</th> \n",
       "        <th class=\"col_heading level0 col8\" >UGDS_NHPI</th> \n",
       "        <th class=\"col_heading level0 col9\" >UGDS_2MOR</th> \n",
       "        <th class=\"col_heading level0 col10\" >UGDS_NRA</th> \n",
       "        <th class=\"col_heading level0 col11\" >UGDS_UNKN</th> \n",
       "        <th class=\"col_heading level0 col12\" >PPTUG_EF</th> \n",
       "        <th class=\"col_heading level0 col13\" >PCTPELL</th> \n",
       "        <th class=\"col_heading level0 col14\" >PCTFLOAN</th> \n",
       "        <th class=\"col_heading level0 col15\" >UG25ABV</th> \n",
       "        <th class=\"col_heading level0 col16\" >MD_EARN_WNE_P10</th> \n",
       "        <th class=\"col_heading level0 col17\" >GRAD_DEBT_MDN_SUPP</th> \n",
       "    </tr>    <tr> \n",
       "        <th class=\"index_name level0\" >INSTNM</th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "    </tr></thead> \n",
       "<tbody>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row0\" class=\"row_heading level0 row0\" >California Institute of Technology</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col0\" class=\"data row0 col0\" >765</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col1\" class=\"data row0 col1\" >785</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col2\" class=\"data row0 col2\" >983</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col3\" class=\"data row0 col3\" >0.2787</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col4\" class=\"data row0 col4\" >0.0153</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col5\" class=\"data row0 col5\" >0.1221</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col6\" class=\"data row0 col6\" >0.4385</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col7\" class=\"data row0 col7\" >0.001</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col8\" class=\"data row0 col8\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col9\" class=\"data row0 col9\" >0.057</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col10\" class=\"data row0 col10\" >0.0875</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col11\" class=\"data row0 col11\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col12\" class=\"data row0 col12\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col13\" class=\"data row0 col13\" >0.1126</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col14\" class=\"data row0 col14\" >0.2303</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col15\" class=\"data row0 col15\" >0.0082</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col16\" class=\"data row0 col16\" >77800</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow0_col17\" class=\"data row0 col17\" >11812.5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row1\" class=\"row_heading level0 row1\" >University of Phoenix-Arizona</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col0\" class=\"data row1 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col1\" class=\"data row1 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col2\" class=\"data row1 col2\" >151558</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col3\" class=\"data row1 col3\" >0.3098</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col4\" class=\"data row1 col4\" >0.1555</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col5\" class=\"data row1 col5\" >0.076</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col6\" class=\"data row1 col6\" >0.0082</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col7\" class=\"data row1 col7\" >0.0042</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col8\" class=\"data row1 col8\" >0.005</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col9\" class=\"data row1 col9\" >0.1131</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col10\" class=\"data row1 col10\" >0.0131</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col11\" class=\"data row1 col11\" >0.3152</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col12\" class=\"data row1 col12\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col13\" class=\"data row1 col13\" >0.6009</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col14\" class=\"data row1 col14\" >0.592</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col15\" class=\"data row1 col15\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col16\" class=\"data row1 col16\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow1_col17\" class=\"data row1 col17\" >33000</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row2\" class=\"row_heading level0 row2\" >Mr Leon's School of Hair Design-Moscow</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col0\" class=\"data row2 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col1\" class=\"data row2 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col2\" class=\"data row2 col2\" >16</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col3\" class=\"data row2 col3\" >1</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col4\" class=\"data row2 col4\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col5\" class=\"data row2 col5\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col6\" class=\"data row2 col6\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col7\" class=\"data row2 col7\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col8\" class=\"data row2 col8\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col9\" class=\"data row2 col9\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col10\" class=\"data row2 col10\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col11\" class=\"data row2 col11\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col12\" class=\"data row2 col12\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col13\" class=\"data row2 col13\" >0.625</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col14\" class=\"data row2 col14\" >0.625</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col15\" class=\"data row2 col15\" >0.2</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col16\" class=\"data row2 col16\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow2_col17\" class=\"data row2 col17\" >15710</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row3\" class=\"row_heading level0 row3\" >Velvatex College of Beauty Culture</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col0\" class=\"data row3 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col1\" class=\"data row3 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col2\" class=\"data row3 col2\" >25</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col3\" class=\"data row3 col3\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col4\" class=\"data row3 col4\" >1</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col5\" class=\"data row3 col5\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col6\" class=\"data row3 col6\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col7\" class=\"data row3 col7\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col8\" class=\"data row3 col8\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col9\" class=\"data row3 col9\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col10\" class=\"data row3 col10\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col11\" class=\"data row3 col11\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col12\" class=\"data row3 col12\" >0.2</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col13\" class=\"data row3 col13\" >0.7692</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col14\" class=\"data row3 col14\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col15\" class=\"data row3 col15\" >0.52</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col16\" class=\"data row3 col16\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow3_col17\" class=\"data row3 col17\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row4\" class=\"row_heading level0 row4\" >Thunderbird School of Global Management</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col0\" class=\"data row4 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col1\" class=\"data row4 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col2\" class=\"data row4 col2\" >1</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col3\" class=\"data row4 col3\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col4\" class=\"data row4 col4\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col5\" class=\"data row4 col5\" >1</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col6\" class=\"data row4 col6\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col7\" class=\"data row4 col7\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col8\" class=\"data row4 col8\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col9\" class=\"data row4 col9\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col10\" class=\"data row4 col10\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col11\" class=\"data row4 col11\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col12\" class=\"data row4 col12\" >1</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col13\" class=\"data row4 col13\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col14\" class=\"data row4 col14\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col15\" class=\"data row4 col15\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col16\" class=\"data row4 col16\" >118900</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow4_col17\" class=\"data row4 col17\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row5\" class=\"row_heading level0 row5\" >Cosmopolitan Beauty and Tech School</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col0\" class=\"data row5 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col1\" class=\"data row5 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col2\" class=\"data row5 col2\" >110</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col3\" class=\"data row5 col3\" >0.0091</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col4\" class=\"data row5 col4\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col5\" class=\"data row5 col5\" >0.0182</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col6\" class=\"data row5 col6\" >0.9727</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col7\" class=\"data row5 col7\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col8\" class=\"data row5 col8\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col9\" class=\"data row5 col9\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col10\" class=\"data row5 col10\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col11\" class=\"data row5 col11\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col12\" class=\"data row5 col12\" >0.3182</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col13\" class=\"data row5 col13\" >0.7761</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col14\" class=\"data row5 col14\" >0.1244</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col15\" class=\"data row5 col15\" >0.9545</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col16\" class=\"data row5 col16\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow5_col17\" class=\"data row5 col17\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row6\" class=\"row_heading level0 row6\" >Haskell Indian Nations University</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col0\" class=\"data row6 col0\" >430</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col1\" class=\"data row6 col1\" >440</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col2\" class=\"data row6 col2\" >805</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col3\" class=\"data row6 col3\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col4\" class=\"data row6 col4\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col5\" class=\"data row6 col5\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col6\" class=\"data row6 col6\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col7\" class=\"data row6 col7\" >1</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col8\" class=\"data row6 col8\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col9\" class=\"data row6 col9\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col10\" class=\"data row6 col10\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col11\" class=\"data row6 col11\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col12\" class=\"data row6 col12\" >0.0224</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col13\" class=\"data row6 col13\" >0.8396</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col14\" class=\"data row6 col14\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col15\" class=\"data row6 col15\" >0.2089</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col16\" class=\"data row6 col16\" >22800</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow6_col17\" class=\"data row6 col17\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row7\" class=\"row_heading level0 row7\" >Palau Community College</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col0\" class=\"data row7 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col1\" class=\"data row7 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col2\" class=\"data row7 col2\" >602</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col3\" class=\"data row7 col3\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col4\" class=\"data row7 col4\" >0.0017</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col5\" class=\"data row7 col5\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col6\" class=\"data row7 col6\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col7\" class=\"data row7 col7\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col8\" class=\"data row7 col8\" >0.9983</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col9\" class=\"data row7 col9\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col10\" class=\"data row7 col10\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col11\" class=\"data row7 col11\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col12\" class=\"data row7 col12\" >0.3887</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col13\" class=\"data row7 col13\" >0.856</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col14\" class=\"data row7 col14\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col15\" class=\"data row7 col15\" >0.2616</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col16\" class=\"data row7 col16\" >24700</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow7_col17\" class=\"data row7 col17\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row8\" class=\"row_heading level0 row8\" >LIU Brentwood</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col0\" class=\"data row8 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col1\" class=\"data row8 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col2\" class=\"data row8 col2\" >15</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col3\" class=\"data row8 col3\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col4\" class=\"data row8 col4\" >0.1333</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col5\" class=\"data row8 col5\" >0.2667</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col6\" class=\"data row8 col6\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col7\" class=\"data row8 col7\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col8\" class=\"data row8 col8\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col9\" class=\"data row8 col9\" >0.5333</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col10\" class=\"data row8 col10\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col11\" class=\"data row8 col11\" >0.0667</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col12\" class=\"data row8 col12\" >0.4</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col13\" class=\"data row8 col13\" >0.5652</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col14\" class=\"data row8 col14\" >0.7826</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col15\" class=\"data row8 col15\" >0.7826</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col16\" class=\"data row8 col16\" >44600</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow8_col17\" class=\"data row8 col17\" >25499</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row9\" class=\"row_heading level0 row9\" >California University of Management and Sciences</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col0\" class=\"data row9 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col1\" class=\"data row9 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col2\" class=\"data row9 col2\" >98</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col3\" class=\"data row9 col3\" >0.0102</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col4\" class=\"data row9 col4\" >0.0204</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col5\" class=\"data row9 col5\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col6\" class=\"data row9 col6\" >0.0408</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col7\" class=\"data row9 col7\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col8\" class=\"data row9 col8\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col9\" class=\"data row9 col9\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col10\" class=\"data row9 col10\" >0.9286</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col11\" class=\"data row9 col11\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col12\" class=\"data row9 col12\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col13\" class=\"data row9 col13\" >0.0926</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col14\" class=\"data row9 col14\" >0.0556</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col15\" class=\"data row9 col15\" >0.6852</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col16\" class=\"data row9 col16\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow9_col17\" class=\"data row9 col17\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row10\" class=\"row_heading level0 row10\" >Le Cordon Bleu College of Culinary Arts-San Francisco</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col0\" class=\"data row10 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col1\" class=\"data row10 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col2\" class=\"data row10 col2\" >442</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col3\" class=\"data row10 col3\" >0.0317</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col4\" class=\"data row10 col4\" >0.009</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col5\" class=\"data row10 col5\" >0.0113</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col6\" class=\"data row10 col6\" >0.0271</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col7\" class=\"data row10 col7\" >0.0045</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col8\" class=\"data row10 col8\" >0.0023</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col9\" class=\"data row10 col9\" >0.0113</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col10\" class=\"data row10 col10\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col11\" class=\"data row10 col11\" >0.9027</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col12\" class=\"data row10 col12\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col13\" class=\"data row10 col13\" >0.3722</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col14\" class=\"data row10 col14\" >0.5358</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col15\" class=\"data row10 col15\" >0.544</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col16\" class=\"data row10 col16\" >34000</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow10_col17\" class=\"data row10 col17\" >12931</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row11\" class=\"row_heading level0 row11\" >MTI Business College Inc</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col0\" class=\"data row11 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col1\" class=\"data row11 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col2\" class=\"data row11 col2\" >146</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col3\" class=\"data row11 col3\" >0.2397</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col4\" class=\"data row11 col4\" >0.5137</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col5\" class=\"data row11 col5\" >0.1438</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col6\" class=\"data row11 col6\" >0.0479</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col7\" class=\"data row11 col7\" >0.0342</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col8\" class=\"data row11 col8\" >0.0205</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col9\" class=\"data row11 col9\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col10\" class=\"data row11 col10\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col11\" class=\"data row11 col11\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col12\" class=\"data row11 col12\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col13\" class=\"data row11 col13\" >1</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col14\" class=\"data row11 col14\" >1</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col15\" class=\"data row11 col15\" >0.3986</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col16\" class=\"data row11 col16\" >23000</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow11_col17\" class=\"data row11 col17\" >9500</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row12\" class=\"row_heading level0 row12\" >ABC Beauty College Inc</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col0\" class=\"data row12 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col1\" class=\"data row12 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col2\" class=\"data row12 col2\" >38</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col3\" class=\"data row12 col3\" >0.2895</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col4\" class=\"data row12 col4\" >0.6579</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col5\" class=\"data row12 col5\" >0.0526</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col6\" class=\"data row12 col6\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col7\" class=\"data row12 col7\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col8\" class=\"data row12 col8\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col9\" class=\"data row12 col9\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col10\" class=\"data row12 col10\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col11\" class=\"data row12 col11\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col12\" class=\"data row12 col12\" >0.2105</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col13\" class=\"data row12 col13\" >0.9815</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col14\" class=\"data row12 col14\" >1</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col15\" class=\"data row12 col15\" >0.4688</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col16\" class=\"data row12 col16\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow12_col17\" class=\"data row12 col17\" >16500</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row13\" class=\"row_heading level0 row13\" >Dongguk University-Los Angeles</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col0\" class=\"data row13 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col1\" class=\"data row13 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col2\" class=\"data row13 col2\" >20</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col3\" class=\"data row13 col3\" >0.35</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col4\" class=\"data row13 col4\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col5\" class=\"data row13 col5\" >0.15</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col6\" class=\"data row13 col6\" >0.5</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col7\" class=\"data row13 col7\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col8\" class=\"data row13 col8\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col9\" class=\"data row13 col9\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col10\" class=\"data row13 col10\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col11\" class=\"data row13 col11\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col12\" class=\"data row13 col12\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col13\" class=\"data row13 col13\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col14\" class=\"data row13 col14\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col15\" class=\"data row13 col15\" >1</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col16\" class=\"data row13 col16\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow13_col17\" class=\"data row13 col17\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row14\" class=\"row_heading level0 row14\" >Medical College of Wisconsin</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col0\" class=\"data row14 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col1\" class=\"data row14 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col2\" class=\"data row14 col2\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col3\" class=\"data row14 col3\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col4\" class=\"data row14 col4\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col5\" class=\"data row14 col5\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col6\" class=\"data row14 col6\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col7\" class=\"data row14 col7\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col8\" class=\"data row14 col8\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col9\" class=\"data row14 col9\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col10\" class=\"data row14 col10\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col11\" class=\"data row14 col11\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col12\" class=\"data row14 col12\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col13\" class=\"data row14 col13\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col14\" class=\"data row14 col14\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col15\" class=\"data row14 col15\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col16\" class=\"data row14 col16\" >233100</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow14_col17\" class=\"data row14 col17\" >nan</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68clevel0_row15\" class=\"row_heading level0 row15\" >Southwest University of Visual Arts-Tucson</th> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col0\" class=\"data row15 col0\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col1\" class=\"data row15 col1\" >nan</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col2\" class=\"data row15 col2\" >161</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col3\" class=\"data row15 col3\" >0.4534</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col4\" class=\"data row15 col4\" >0.0435</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col5\" class=\"data row15 col5\" >0.3168</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col6\" class=\"data row15 col6\" >0.0062</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col7\" class=\"data row15 col7\" >0.0311</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col8\" class=\"data row15 col8\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col9\" class=\"data row15 col9\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col10\" class=\"data row15 col10\" >0</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col11\" class=\"data row15 col11\" >0.1491</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col12\" class=\"data row15 col12\" >0.2795</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col13\" class=\"data row15 col13\" >0.4469</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col14\" class=\"data row15 col14\" >0.4292</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col15\" class=\"data row15 col15\" >0.8657</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col16\" class=\"data row15 col16\" >27200</td> \n",
       "        <td id=\"T_e4c6f31a_b3cc_11e7_862c_b8e85647e68crow15_col17\" class=\"data row15 col17\" >49750</td> \n",
       "    </tr></tbody> \n",
       "</table> "
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x117f0d080>"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college_n2.loc[unique_max_cols].style.highlight_max()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "scrolled": true
   },
   "source": [
    "## There's more..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow0_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow1_col0 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow2_col1 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow3_col0 {\n",
       "            background-color:  yellow;\n",
       "        }    #T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow4_col1 {\n",
       "            background-color:  yellow;\n",
       "        }</style>  \n",
       "<table id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68c\" > \n",
       "<thead>    <tr> \n",
       "        <th class=\"blank level0\" ></th> \n",
       "        <th class=\"col_heading level0 col0\" >UGDS_WHITE</th> \n",
       "        <th class=\"col_heading level0 col1\" >UGDS_BLACK</th> \n",
       "        <th class=\"col_heading level0 col2\" >UGDS_HISP</th> \n",
       "        <th class=\"col_heading level0 col3\" >UGDS_ASIAN</th> \n",
       "        <th class=\"col_heading level0 col4\" >UGDS_AIAN</th> \n",
       "        <th class=\"col_heading level0 col5\" >UGDS_NHPI</th> \n",
       "        <th class=\"col_heading level0 col6\" >UGDS_2MOR</th> \n",
       "        <th class=\"col_heading level0 col7\" >UGDS_NRA</th> \n",
       "        <th class=\"col_heading level0 col8\" >UGDS_UNKN</th> \n",
       "    </tr>    <tr> \n",
       "        <th class=\"index_name level0\" >INSTNM</th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "    </tr></thead> \n",
       "<tbody>    <tr> \n",
       "        <th id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68clevel0_row0\" class=\"row_heading level0 row0\" >Alabama A & M University</th> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow0_col0\" class=\"data row0 col0\" >0.0333</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow0_col1\" class=\"data row0 col1\" >0.9353</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow0_col2\" class=\"data row0 col2\" >0.0055</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow0_col3\" class=\"data row0 col3\" >0.0019</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow0_col4\" class=\"data row0 col4\" >0.0024</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow0_col5\" class=\"data row0 col5\" >0.0019</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow0_col6\" class=\"data row0 col6\" >0</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow0_col7\" class=\"data row0 col7\" >0.0059</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow0_col8\" class=\"data row0 col8\" >0.0138</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68clevel0_row1\" class=\"row_heading level0 row1\" >University of Alabama at Birmingham</th> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow1_col0\" class=\"data row1 col0\" >0.5922</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow1_col1\" class=\"data row1 col1\" >0.26</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow1_col2\" class=\"data row1 col2\" >0.0283</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow1_col3\" class=\"data row1 col3\" >0.0518</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow1_col4\" class=\"data row1 col4\" >0.0022</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow1_col5\" class=\"data row1 col5\" >0.0007</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow1_col6\" class=\"data row1 col6\" >0.0368</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow1_col7\" class=\"data row1 col7\" >0.0179</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow1_col8\" class=\"data row1 col8\" >0.01</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68clevel0_row2\" class=\"row_heading level0 row2\" >Amridge University</th> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow2_col0\" class=\"data row2 col0\" >0.299</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow2_col1\" class=\"data row2 col1\" >0.4192</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow2_col2\" class=\"data row2 col2\" >0.0069</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow2_col3\" class=\"data row2 col3\" >0.0034</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow2_col4\" class=\"data row2 col4\" >0</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow2_col5\" class=\"data row2 col5\" >0</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow2_col6\" class=\"data row2 col6\" >0</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow2_col7\" class=\"data row2 col7\" >0</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow2_col8\" class=\"data row2 col8\" >0.2715</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68clevel0_row3\" class=\"row_heading level0 row3\" >University of Alabama in Huntsville</th> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow3_col0\" class=\"data row3 col0\" >0.6988</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow3_col1\" class=\"data row3 col1\" >0.1255</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow3_col2\" class=\"data row3 col2\" >0.0382</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow3_col3\" class=\"data row3 col3\" >0.0376</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow3_col4\" class=\"data row3 col4\" >0.0143</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow3_col5\" class=\"data row3 col5\" >0.0002</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow3_col6\" class=\"data row3 col6\" >0.0172</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow3_col7\" class=\"data row3 col7\" >0.0332</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow3_col8\" class=\"data row3 col8\" >0.035</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68clevel0_row4\" class=\"row_heading level0 row4\" >Alabama State University</th> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow4_col0\" class=\"data row4 col0\" >0.0158</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow4_col1\" class=\"data row4 col1\" >0.9208</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow4_col2\" class=\"data row4 col2\" >0.0121</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow4_col3\" class=\"data row4 col3\" >0.0019</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow4_col4\" class=\"data row4 col4\" >0.001</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow4_col5\" class=\"data row4 col5\" >0.0006</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow4_col6\" class=\"data row4 col6\" >0.0098</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow4_col7\" class=\"data row4 col7\" >0.0243</td> \n",
       "        <td id=\"T_e4d360dc_b3cc_11e7_b3ff_b8e85647e68crow4_col8\" class=\"data row4 col8\" >0.0137</td> \n",
       "    </tr></tbody> \n",
       "</table> "
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x119723978>"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college = pd.read_csv('data/college.csv', index_col='INSTNM')\n",
    "college_ugds = college.filter(like='UGDS_').head()\n",
    "college_ugds.style.highlight_max(axis='columns')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timedelta('365 days 05:49:12')"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.Timedelta(1, unit='Y')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Replicating idxmax with method chaining"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "college = pd.read_csv('data/college.csv', index_col='INSTNM')\n",
    "\n",
    "cols = ['MD_EARN_WNE_P10', 'GRAD_DEBT_MDN_SUPP']\n",
    "for col in cols:\n",
    "    college[col] = pd.to_numeric(college[col], errors='coerce')\n",
    "\n",
    "college_n = college.select_dtypes(include=[np.number])\n",
    "criteria = college_n.nunique() == 2\n",
    "binary_cols = college_n.columns[criteria].tolist()\n",
    "college_n = college_n.drop(labels=binary_cols, axis='columns')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "SATVRMID         765.0\n",
       "SATMTMID         785.0\n",
       "UGDS          151558.0\n",
       "UGDS_WHITE         1.0\n",
       "UGDS_BLACK         1.0\n",
       "dtype: float64"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college_n.max().head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>SATVRMID</th>\n",
       "      <th>SATMTMID</th>\n",
       "      <th>UGDS</th>\n",
       "      <th>...</th>\n",
       "      <th>UG25ABV</th>\n",
       "      <th>MD_EARN_WNE_P10</th>\n",
       "      <th>GRAD_DEBT_MDN_SUPP</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>INSTNM</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Alabama A &amp; M University</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>University of Alabama at Birmingham</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Amridge University</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>University of Alabama in Huntsville</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Alabama State University</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 18 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     SATVRMID  SATMTMID   UGDS  \\\n",
       "INSTNM                                                           \n",
       "Alabama A & M University                False     False  False   \n",
       "University of Alabama at Birmingham     False     False  False   \n",
       "Amridge University                      False     False  False   \n",
       "University of Alabama in Huntsville     False     False  False   \n",
       "Alabama State University                False     False  False   \n",
       "\n",
       "                                            ...          UG25ABV  \\\n",
       "INSTNM                                      ...                    \n",
       "Alabama A & M University                    ...            False   \n",
       "University of Alabama at Birmingham         ...            False   \n",
       "Amridge University                          ...            False   \n",
       "University of Alabama in Huntsville         ...            False   \n",
       "Alabama State University                    ...            False   \n",
       "\n",
       "                                     MD_EARN_WNE_P10  GRAD_DEBT_MDN_SUPP  \n",
       "INSTNM                                                                    \n",
       "Alabama A & M University                       False               False  \n",
       "University of Alabama at Birmingham            False               False  \n",
       "Amridge University                             False               False  \n",
       "University of Alabama in Huntsville            False               False  \n",
       "Alabama State University                       False               False  \n",
       "\n",
       "[5 rows x 18 columns]"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college_n.eq(college_n.max()).head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "INSTNM\n",
       "Alabama A & M University               False\n",
       "University of Alabama at Birmingham    False\n",
       "Amridge University                     False\n",
       "University of Alabama in Huntsville    False\n",
       "Alabama State University               False\n",
       "dtype: bool"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "has_row_max = college_n.eq(college_n.max()).any(axis='columns')\n",
    "has_row_max.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(7535, 18)"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college_n.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "401"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "has_row_max.sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "pd.options.display.max_rows=6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>SATVRMID</th>\n",
       "      <th>SATMTMID</th>\n",
       "      <th>UGDS</th>\n",
       "      <th>...</th>\n",
       "      <th>UG25ABV</th>\n",
       "      <th>MD_EARN_WNE_P10</th>\n",
       "      <th>GRAD_DEBT_MDN_SUPP</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>INSTNM</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Alabama A &amp; M University</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>University of Alabama at Birmingham</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Amridge University</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>National Personal Training Institute of Cleveland</th>\n",
       "      <td>7307</td>\n",
       "      <td>7307</td>\n",
       "      <td>417</td>\n",
       "      <td>...</td>\n",
       "      <td>36207</td>\n",
       "      <td>3447</td>\n",
       "      <td>10270</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Bay Area Medical Academy - San Jose Satellite Location</th>\n",
       "      <td>7308</td>\n",
       "      <td>7308</td>\n",
       "      <td>418</td>\n",
       "      <td>...</td>\n",
       "      <td>36219</td>\n",
       "      <td>3448</td>\n",
       "      <td>10272</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Excel Learning Center-San Antonio South</th>\n",
       "      <td>7309</td>\n",
       "      <td>7309</td>\n",
       "      <td>419</td>\n",
       "      <td>...</td>\n",
       "      <td>36231</td>\n",
       "      <td>3449</td>\n",
       "      <td>10274</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>7535 rows × 18 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                    SATVRMID  SATMTMID  UGDS  \\\n",
       "INSTNM                                                                         \n",
       "Alabama A & M University                                   0         0     0   \n",
       "University of Alabama at Birmingham                        0         0     0   \n",
       "Amridge University                                         0         0     0   \n",
       "...                                                      ...       ...   ...   \n",
       "National Personal Training Institute of Cleveland       7307      7307   417   \n",
       "Bay Area Medical Academy - San Jose Satellite L...      7308      7308   418   \n",
       "Excel Learning Center-San Antonio South                 7309      7309   419   \n",
       "\n",
       "                                                           ...          \\\n",
       "INSTNM                                                     ...           \n",
       "Alabama A & M University                                   ...           \n",
       "University of Alabama at Birmingham                        ...           \n",
       "Amridge University                                         ...           \n",
       "...                                                        ...           \n",
       "National Personal Training Institute of Cleveland          ...           \n",
       "Bay Area Medical Academy - San Jose Satellite L...         ...           \n",
       "Excel Learning Center-San Antonio South                    ...           \n",
       "\n",
       "                                                    UG25ABV  MD_EARN_WNE_P10  \\\n",
       "INSTNM                                                                         \n",
       "Alabama A & M University                                  0                0   \n",
       "University of Alabama at Birmingham                       0                0   \n",
       "Amridge University                                        0                0   \n",
       "...                                                     ...              ...   \n",
       "National Personal Training Institute of Cleveland     36207             3447   \n",
       "Bay Area Medical Academy - San Jose Satellite L...    36219             3448   \n",
       "Excel Learning Center-San Antonio South               36231             3449   \n",
       "\n",
       "                                                    GRAD_DEBT_MDN_SUPP  \n",
       "INSTNM                                                                  \n",
       "Alabama A & M University                                             0  \n",
       "University of Alabama at Birmingham                                  0  \n",
       "Amridge University                                                   0  \n",
       "...                                                                ...  \n",
       "National Personal Training Institute of Cleveland                10270  \n",
       "Bay Area Medical Academy - San Jose Satellite L...               10272  \n",
       "Excel Learning Center-San Antonio South                          10274  \n",
       "\n",
       "[7535 rows x 18 columns]"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college_n.eq(college_n.max()).cumsum().cumsum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "INSTNM\n",
       "Alabama A & M University               False\n",
       "University of Alabama at Birmingham    False\n",
       "Amridge University                     False\n",
       "University of Alabama in Huntsville    False\n",
       "Alabama State University               False\n",
       "dtype: bool"
      ]
     },
     "execution_count": 84,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "has_row_max2 = college_n.eq(college_n.max())\\\n",
    "                        .cumsum()\\\n",
    "                        .cumsum()\\\n",
    "                        .eq(1)\\\n",
    "                        .any(axis='columns')\n",
    "has_row_max2.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "16"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "has_row_max2.sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['Thunderbird School of Global Management',\n",
       "       'Southwest University of Visual Arts-Tucson', 'ABC Beauty College Inc',\n",
       "       'Velvatex College of Beauty Culture',\n",
       "       'California Institute of Technology',\n",
       "       'Le Cordon Bleu College of Culinary Arts-San Francisco',\n",
       "       'MTI Business College Inc', 'Dongguk University-Los Angeles',\n",
       "       'Mr Leon's School of Hair Design-Moscow',\n",
       "       'Haskell Indian Nations University', 'LIU Brentwood',\n",
       "       'Medical College of Wisconsin', 'Palau Community College',\n",
       "       'California University of Management and Sciences',\n",
       "       'Cosmopolitan Beauty and Tech School', 'University of Phoenix-Arizona'],\n",
       "      dtype='object', name='INSTNM')"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "idxmax_cols = has_row_max2[has_row_max2].index\n",
    "idxmax_cols"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "set(college_n.idxmax().unique()) == set(idxmax_cols)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## There's more..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.11 ms ± 50.9 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit college_n.idxmax().values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5.26 ms ± 35.6 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n"
     ]
    }
   ],
   "source": [
    "%timeit college_n.eq(college_n.max())\\\n",
    "                              .cumsum()\\\n",
    "                              .cumsum()\\\n",
    "                              .eq(1)\\\n",
    "                              .any(axis='columns')\\\n",
    "                              [lambda x: x].index"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Finding the most common maximum"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "pd.options.display.max_rows= 40"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>UGDS_WHITE</th>\n",
       "      <th>UGDS_BLACK</th>\n",
       "      <th>UGDS_HISP</th>\n",
       "      <th>...</th>\n",
       "      <th>UGDS_2MOR</th>\n",
       "      <th>UGDS_NRA</th>\n",
       "      <th>UGDS_UNKN</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>INSTNM</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Alabama A &amp; M University</th>\n",
       "      <td>0.0333</td>\n",
       "      <td>0.9353</td>\n",
       "      <td>0.0055</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0059</td>\n",
       "      <td>0.0138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>University of Alabama at Birmingham</th>\n",
       "      <td>0.5922</td>\n",
       "      <td>0.2600</td>\n",
       "      <td>0.0283</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0368</td>\n",
       "      <td>0.0179</td>\n",
       "      <td>0.0100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Amridge University</th>\n",
       "      <td>0.2990</td>\n",
       "      <td>0.4192</td>\n",
       "      <td>0.0069</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.2715</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>University of Alabama in Huntsville</th>\n",
       "      <td>0.6988</td>\n",
       "      <td>0.1255</td>\n",
       "      <td>0.0382</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0172</td>\n",
       "      <td>0.0332</td>\n",
       "      <td>0.0350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Alabama State University</th>\n",
       "      <td>0.0158</td>\n",
       "      <td>0.9208</td>\n",
       "      <td>0.0121</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0098</td>\n",
       "      <td>0.0243</td>\n",
       "      <td>0.0137</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     UGDS_WHITE  UGDS_BLACK  UGDS_HISP  \\\n",
       "INSTNM                                                                   \n",
       "Alabama A & M University                 0.0333      0.9353     0.0055   \n",
       "University of Alabama at Birmingham      0.5922      0.2600     0.0283   \n",
       "Amridge University                       0.2990      0.4192     0.0069   \n",
       "University of Alabama in Huntsville      0.6988      0.1255     0.0382   \n",
       "Alabama State University                 0.0158      0.9208     0.0121   \n",
       "\n",
       "                                       ...      UGDS_2MOR  UGDS_NRA  UGDS_UNKN  \n",
       "INSTNM                                 ...                                      \n",
       "Alabama A & M University               ...         0.0000    0.0059     0.0138  \n",
       "University of Alabama at Birmingham    ...         0.0368    0.0179     0.0100  \n",
       "Amridge University                     ...         0.0000    0.0000     0.2715  \n",
       "University of Alabama in Huntsville    ...         0.0172    0.0332     0.0350  \n",
       "Alabama State University               ...         0.0098    0.0243     0.0137  \n",
       "\n",
       "[5 rows x 9 columns]"
      ]
     },
     "execution_count": 91,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college = pd.read_csv('data/college.csv', index_col='INSTNM')\n",
    "college_ugds = college.filter(like='UGDS_')\n",
    "college_ugds.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "INSTNM\n",
       "Alabama A & M University               UGDS_BLACK\n",
       "University of Alabama at Birmingham    UGDS_WHITE\n",
       "Amridge University                     UGDS_BLACK\n",
       "University of Alabama in Huntsville    UGDS_WHITE\n",
       "Alabama State University               UGDS_BLACK\n",
       "dtype: object"
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "highest_percentage_race = college_ugds.idxmax(axis='columns')\n",
    "highest_percentage_race.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "UGDS_WHITE    0.670352\n",
       "UGDS_BLACK    0.151586\n",
       "UGDS_HISP     0.129473\n",
       "UGDS_UNKN     0.023422\n",
       "UGDS_ASIAN    0.012074\n",
       "UGDS_AIAN     0.006110\n",
       "UGDS_NRA      0.004073\n",
       "UGDS_NHPI     0.001746\n",
       "UGDS_2MOR     0.001164\n",
       "dtype: float64"
      ]
     },
     "execution_count": 93,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "highest_percentage_race.value_counts(normalize=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# There's more..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "UGDS_WHITE    0.661228\n",
       "UGDS_HISP     0.230326\n",
       "UGDS_UNKN     0.071977\n",
       "UGDS_NRA      0.018234\n",
       "UGDS_ASIAN    0.009597\n",
       "UGDS_2MOR     0.006718\n",
       "UGDS_NHPI     0.000960\n",
       "UGDS_AIAN     0.000960\n",
       "dtype: float64"
      ]
     },
     "execution_count": 94,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "college_black = college_ugds[highest_percentage_race == 'UGDS_BLACK']\n",
    "college_black = college_black.drop('UGDS_BLACK', axis='columns')\n",
    "college_black.idxmax(axis='columns').value_counts(normalize=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
